package com.hfut.eeg.common.util;

import com.hfut.eeg.dto.DoctorUserInfo;
import com.hfut.eeg.service.SetupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author 梁琦
 * @program: eeg
 * @Package com.hfut.eeg.common.util
 * @Description: 生成数据库数据
 * @date 2019-12-10 11:00
 */
@Component
public class DatabaseGenerator {

    @Autowired
    private SetupService setupService;

    @Autowired
    private GenerateCommon common;

    /**
    * 用于自动生成数据库数据
    */
    public void init(){
        for (int i=0;i<100000;i++){
            DoctorUserInfo info = new DoctorUserInfo();
            common.initID(setupService);
            info.setDoctorId(common.generateID(setupService));
            info.setGender('男');
            info.setAuthority(1);
            info.setCname(RandomUtil.getRandomJianHan(3));
            info.setPasswd("1234");
            setupService.addDoctor(info);
        }
    }
}
